package javaweb.controller;

import javaweb.pojo.ClazzOption;
import javaweb.pojo.JobOption;
import javaweb.pojo.Result;
import javaweb.sevice.ReportDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportDataController {

    @Autowired
    private ReportDataService reportDataService;

    /*
     * 获取员工职位报表
     * */
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("获取员工职位报表");
        JobOption jobOption = reportDataService.getEmpJobData();
        return Result.success(jobOption);
    }

    /*
     * 获取性别分类后的员工数量
     * */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        log.info("员工性别报表");
        List<Map<String, Object>> list = reportDataService.getEmpGenderData();
        return Result.success(list);
    }

    /*
    * 获取学员班级人数报表
    * */
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        log.info("学员班级人数报表");
        ClazzOption list = reportDataService.getStudentCountData();
        return Result.success(list);
    }

    /*
    * 获取学员的学历信息报表
    * */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        log.info("学员的学历信息报表");
        List<Map<String, Object>> list = reportDataService.getStudentDegreeData();
        return Result.success(list);
    }
}
